package com.qzsoft.zhjd.materiel.modules.materielitem.entity;

import java.math.BigDecimal;
import java.util.Date;

import javax.validation.constraints.DecimalMax;
import javax.validation.constraints.NotBlank;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;

/**
 * @ClassName MaterielItemBaseEntity
 * @Description 养护基地材料字典
 * @author linhuawei
 * @since 2022-03-30
 */
@Data
@EqualsAndHashCode(callSuper = false)
@NoArgsConstructor
@AllArgsConstructor
@Builder
@ToString
@TableName("n_materiel_item_base")
public class MaterielItemBaseEntity {
    /**
     * 主键
     */
    @NotBlank(message = "材料标识不可为空")
    @TableId(type = IdType.ASSIGN_UUID)
    private String id;

    /**
     * 基地编码
     */
    @TableField(updateStrategy = FieldStrategy.NEVER)
    private String baseCode;

    /**
     * 材料名称
     */
    @TableField(updateStrategy = FieldStrategy.NEVER)
    private String materielItemId;

    /**
     * 正差值
     */
    @DecimalMax(value = "100", message = "正差值超出上限")
    @TableField(updateStrategy = FieldStrategy.IGNORED)
    private BigDecimal upperLimit;

    /**
     * 负差值
     */
    @DecimalMax(value = "100", message = "负差值超出上限")
    @TableField(updateStrategy = FieldStrategy.IGNORED)
    private BigDecimal lowerLimit;

    /**
     * 单位换算
     */
    @DecimalMax(value = "99999999.99", message = "单位换算超出上限")
    @TableField(updateStrategy = FieldStrategy.IGNORED)
    private BigDecimal convRate;

    /**
     * 添加人主键
     */
    @TableField(fill = FieldFill.INSERT, updateStrategy = FieldStrategy.NEVER)
    private Long creator;

    /**
     * 添加时间
     */
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date createDate;

    /**
     * 最后修改人主键
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Long updater;

    /**
     * 最后修改时间
     */
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date updateDate;

}
